package com.dz.risk.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dz.risk.common.ResponseVO;
import com.dz.risk.common.exception.RRException;
import com.dz.risk.pojo.QueryParams;
import com.dz.risk.pojo.domain.SystemLogEntity;
import com.dz.risk.pojo.model.PageModel;
import com.dz.risk.service.SystemLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 系统日志
 *
 * @author yinpl
 */
@RestController
@RequestMapping("dz-ftsp/stest/systemlog")
@Api(tags = "查询日志api", value = "查询日志api接口")
@Slf4j
public class SystemLogController {
    @Autowired
    private SystemLogService tStSystemLogService;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 查询操作日志
     *
     */
    @ApiOperation("查询操作日志")
    @GetMapping(value = "/query")
    public ResponseVO querySystemLog(PageModel pageModel,SystemLogEntity systemLogEntity) {
        IPage<SystemLogEntity> iPage =null;
        try {
            iPage = tStSystemLogService.querySystemLog(pageModel,systemLogEntity);
        } catch (RRException e) {
            e.printStackTrace();
            logger.error("查询日志信息失败！" + e);
            return new ResponseVO(e.getCode(), e.getMessage());
        }
        return ResponseVO.ok(iPage);
    }


}
